package com.moneylee.xdstudy.task;

import org.springframework.stereotype.Component;
import org.springframework.scheduling.annotation.Async;
/**
 * @className: Async
 * @Description: 异步任务
 * @Author moneylee
 * @Date 2020-07-02 18:41
 * @Version 1.0
 **/
@Component
@Async
public class Async {


    public void task1() {
        try {
            Thread.sleep(4000L);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println("task 1");
    }

    public void task2() {
        try {
            Thread.sleep(4000L);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println("task 2");
    }

    public void task3() {
        try {
            Thread.sleep(4000L);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println("task 3");
    }

}
